//
//  UINavigationBar+MoCard.m
//  MoCard
//
//  Created by 水石 温 on 11-10-21.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//


#import "UINavigationBarCatalog.h"

@implementation UINavigationBar (UINavigationBarCategory)

-(void)drawRect:(CGRect)rect {//该函数只影响iOS4
    UIImage *img=[UIImage imageNamed:@"navi_bar_bg.png"];
    img=[img stretchableImageWithLeftCapWidth:5 topCapHeight:0];
    UIImage *naviBarBgImage = img;
    [naviBarBgImage drawInRect:rect];
}

-(void)setBackgroundImage:(UIImage*)image
{
    UIImageView *backgroundView = [[UIImageView alloc] initWithImage:image];
    backgroundView.backgroundColor = [UIColor grayColor];
    backgroundView.frame = CGRectMake(0.f, 0.f, self.frame.size.width, self.frame.size.height);
    backgroundView.autoresizingMask  = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    [self addSubview:backgroundView];
    [self sendSubviewToBack:backgroundView];
}

@end
